package com.heer.gymnasium.module.team.beans;

import android.text.TextUtils;
import android.view.View;

import com.heer.gymnasium.R;
import com.heer.gymnasium.base.BaseBean;
import com.heer.gymnasium.constant.Type;

import java.util.ArrayList;
import java.util.Collection;
import java.util.List;

/**
 * Created by yan
 * on 2018/2/12
 */

public class TeamBean extends BaseBean {
    private String id;

    private String teamName;
    //1,白金战队 2黄金战队 3白银战队 4青铜战队
    private int teamType;

    private boolean isContain;

    private String peopleNum;

    private String iconUrl;

    private boolean isCreate;

    private boolean isSelected;

    private String captain_id;

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getTeamName() {
        return teamName;
    }

    public void setTeamName(String teamName) {
        this.teamName = teamName;
    }

    public int getTeamType() {
        return teamType;
    }

    public void setTeamType(int teamType) {
        this.teamType = teamType;
    }

    public boolean isContain() {
        return isContain;
    }

    public void setContain(boolean contain) {
        isContain = contain;
    }

    public String getPeopleNum() {
        return peopleNum;
    }

    public void setPeopleNum(String peopleNum) {
        this.peopleNum = peopleNum;
    }

    public String getIconUrl() {
        return iconUrl;
    }

    public void setIconUrl(String iconUrl) {
        this.iconUrl = iconUrl;
    }

    public boolean isCreate() {
        return isCreate;
    }

    public void setCreate(boolean create) {
        isCreate = create;
    }

    public boolean isSelected() {
        return isSelected;
    }

    public void setSelected(boolean selected) {
        isSelected = selected;
    }

    public String getCaptain_id() {
        return captain_id;
    }

    public void setCaptain_id(String captain_id) {
        this.captain_id = captain_id;
    }


    public static Collection<? extends TeamBean> dataChange(List<TeamResponseBean.Item> data) {
        List<TeamBean> newList = new ArrayList<>();
        for (TeamResponseBean.Item item : data) {
            TeamBean bean = new TeamBean();
            bean.setId(item.getCorps_id());
            bean.setContain(TextUtils.equals(item.getIs_captain(), Type.YES));
            bean.setIconUrl(item.getLogo());
            bean.setPeopleNum(item.getNum());
            bean.setTeamName(item.getCorps_name());
            bean.setCaptain_id(item.getCaptain_id());
            if (item.getGrade().equals("青铜战队")) {
                bean.setTeamType(4);
            } else if (item.getGrade().equals("白银战队")) {
                bean.setTeamType(3);
            } else if (item.getGrade().equals("黄金战队")) {
                bean.setTeamType(2);
            } else if (item.getGrade().equals("白金战队")) {
                bean.setTeamType(1);
            }
            newList.add(bean);
        }
        return newList;
    }
}
